package com.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mall.db.domain.FeedBack;
import com.mall.db.service.FeedBackService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/system/fb")
public class FeedBackController extends BaseController<FeedBack> {

    @Resource(name = "feedBackService")
    private FeedBackService fbs;

    @Override
    public Map<String, Object> find(FeedBack feedback) {
        PageHelper.startPage(feedback.getPage(),feedback.getLimit());
        QueryWrapper<FeedBack> qw = new QueryWrapper<>();
        List<FeedBack> list = fbs.list(qw);
        PageInfo<FeedBack> pageInfo = new PageInfo<>(list,feedback.getLimit());
        return findMap(pageInfo.getList(),pageInfo.getTotal());
    }
}
